package com.ruoyi.project.jiaowu.kaikeinqure.controller;

import com.github.pagehelper.PageInfo;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.jiaowu.kaikeinqure.domain.TbKaikeInqure;
import com.ruoyi.project.jiaowu.kaikeinqure.service.ITbKaikeInqureService;
import com.ruoyi.project.jiaowu.kaikeplan.domain.TbKaikePlan;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("website/kaikeinqure")
public class TbKaikeInqureController extends BaseController {


    private String prefix = "system/jiaowukaikeinqure";

    @Autowired
    private ITbKaikeInqureService iTbKaikeInqureService;

    @RequiresPermissions("website:kaikeinqure:view")
    @GetMapping()
    public String inqure()
    {
        return prefix + "/inqure";
    }

    /**
     * 查询开课计划列表
     */
    @RequiresPermissions("website:kaikeinqure:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo selectTbKaikeInqureList( TbKaikeInqure tbKaikeInqure)
    {
        startPage();
        List<TbKaikeInqure> list = iTbKaikeInqureService.selectTbKaikeInqureList(tbKaikeInqure);
        for(TbKaikeInqure lists:list){
            if(lists.getClassmaxweek()!=null && lists.getClasslowweek()!=null){
                lists.setClassweek(lists.getClasslowweek().toString()+"-"+lists.getClassmaxweek().toString());
            }
            if(lists.getStulownumber()!=null && lists.getStumaxnumber()!=null){
                lists.setStunumber(lists.getStulownumber().toString()+"-"+lists.getStumaxnumber().toString());
            }
        }
        return getDataTable(list);
    }

}
